package com.yuanyefu.helloworld;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * Created by Administrator on 2017/9/16 0016.
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
    public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
        System.out.println(">>postProcessBeforeInitialization: "+name);
        return bean;
    }

    public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
        System.out.println(">>postProcessAfterInitialization: "+name);
        if (bean instanceof BasicBean){
            System.out.println(">> Check BasicBean...");
            BasicBean bb=(BasicBean) bean;
            bb.setTitle(bb.getTitle().toLowerCase());
        }
        return bean;
    }
}
